#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, h[N], f[N], q[N];
int res = -1, cnt = 0;

int main() {
  while (cin >> h[n]) n++;
  for (int i = 0; i < n; ++i) {
    f[i] = 1;
    for (int j = 0; j < i; ++j) {
      if (h[i] <= h[j]) {
        f[i] = max(f[i], f[j] + 1);
      }
      res = max(res, f[i]);
    }

    int k = 0;
    while (k < cnt && q[k] < h[i]) k++;
    if (k == cnt)
      q[cnt++] = h[i];
    else
      q[k] = h[i];
  }
  cout << res << '\n' << cnt << endl;
}
